import Vue from 'vue';
import Vuex from 'vuex';
import moduleA from './moduleA.js';
import moduleB from './moduleB.js';

Vue.use(Vuex);

// 创建一个新的 store 实例
const store = new Vuex.Store(
    {
        state: {
            count: 0,
        },
        getters: {
            getSum: (state) => {
                state.count = state.a.count + state.b.count;
                return state.count;
            }
        },
        modules: {
            a: moduleA,
            b: moduleB
        }
    }
)
export default store;